home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Science / Asymptote Demo / Examples / Utility Scripts / planck < prev    next >
Text File  |  1994-05-07  |  609b  |  25 lines

  1. % PLANCK T(K) [ergs s-1 cm-2 Hs-1 steradians-1]
  2. % Calculate a Planck function
  3.  
  4. % ARGUMENT:
  5. %    T    -- Temperature (in Kelvins)
  6. %
  7. % DESCRIPTION:
  8. % Use the frequencies (Hz) stored in the X vector and the specified
  9. % temperature T (Kelvins) to calculate the Planck function
  10. % Store the result in Y
  11.  
  12. hide
  13. constants        % Load some basic physical constants
  14.  
  15. rpn <x h * k &1 * / dup % Calculate the argument to the exponential 
  16.  
  17. % Check to see to see if we might overflow the e^x function:
  18. rpn 5000 < xy * e^x 1 - 1 xy 
  19. rpn dup 0 = + / dup 1 ≠ * 
  20.  
  21. % Multiply by the rest of the terms
  22. rpn 2 * h * <x 3 y^x * c dup * / >y
  23.  
  24.  
  25.